package com.alick.third_push;

import android.content.Context;

import com.igexin.sdk.PushManager;
import com.tencent.android.tpush.XGIOperateCallback;
import com.tencent.android.tpush.XGPushConfig;
import com.tencent.android.tpush.XGPushManager;

import common.utils.BLog;
import com.alick.third_push.getui.GeTuiIntentService;
import com.alick.third_push.getui.GeTuiPushService;
import com.alick.third_push.jpush.JPushHelper;

/**
 * 功能:
 * 作者: 崔兴旺
 * 日期: 2017/12/13
 * 备注:
 */
public class PushInitUtils {
    public static void initXGPush(Context context) {
        XGPushConfig.enableDebug(context, PushDebug.IS_DEBUG);
        XGPushManager.registerPush(context, new XGIOperateCallback() {
            @Override
            public void onSuccess(Object data, int flag) {
                //token在设备卸载重装的时候有可能会变
                BLog.d("TPush", "信鸽推送注册成功，设备token为：" + data);
            }
            @Override
            public void onFail(Object data, int errCode, String msg) {
                BLog.d("TPush", "信鸽推送注册失败，错误码：" + errCode + ",错误信息：" + msg);
            }
        });
    }

    public static void initGetui(Context context) {
        PushManager.getInstance().initialize(context.getApplicationContext(), GeTuiPushService.class);
        PushManager.getInstance().registerPushIntentService(context.getApplicationContext(), GeTuiIntentService.class);
    }

    public static void initJPush(Context context) {
        JPushHelper.getInstance().init(context);
    }


}
